package com.ybkj.o2o.zhuanxian.mapper;

import com.ybkj.o2o.zhuanxian.entity.Car;
import com.ybkj.o2o.zhuanxian.entity.Line;

import org.apache.ibatis.annotations.Param;

import java.util.List;

public interface LineMapper {

  int insert(Line record);

  Line findById(@Param("id") Long id, @Param("appKey") String appKey);

  int deleteLine(@Param("id") Long id, @Param("appKey") String appKey);

  List<Line> findByParam(@Param("companyId") Long companyId,
      @Param("companyName") String companyName, @Param("name") String name,
      @Param("startCity") String startCity, @Param("startAddress") String startAddress,
      @Param("endCity") String endCity, @Param("endAddress") String endAddress,
      @Param("limit") Integer limit, @Param("rows") Integer rows, @Param("appKey") String appKey);

  Long countByParam(@Param("companyId") Long companyId, @Param("companyName") String companyName,
      @Param("name") String name, @Param("startCity") String startCity,
      @Param("startAddress") String startAddress, @Param("endCity") String endCity,
      @Param("endAddress") String endAddress, @Param("appKey") String appKey);

  int update(Line line);

  Line findByLineId(@Param("lineId") Long lineId, @Param("appKey") String appKey);

  List<Line> findByIds(@Param("lineIds") List<Long> lineIds);

  List<Line> findAll(@Param("city") String city, @Param("appKey") String appKey);

  List<Car> findCarByIds(List<Long> ids);

  List<Line> findLineByCompany(@Param("companyId") Long companyId, @Param("city") String city,
      @Param("appKey") String appKey);

  List<Line> findByCityAndAddress(@Param("companyId") Long companyId,
      @Param("startCity") String startCity, @Param("startAddress") String startAddress,
      @Param("endCity") String endCity, @Param("endAddress") String endAddress);

  List<Line> findStartEndByLine(@Param("startCity") String startCity,
      @Param("endCity") String endCity, @Param("appKey") String appKey);

  List<Line> findByCompany(@Param("companyId") Long companyId, @Param("appKey") String appKey);


  List<Line> queryLineByStartCity(@Param("startCity") String startCity,
      @Param("appKey") String appKey);

  List<Line> queryEndLineBySatrt(@Param("startCity") String startCity,
      @Param("startAddress") String startAddress,@Param("endCity") String endCity,
      @Param("appKey") String appKey);

  Long countByAddress(@Param("companyId")Long companyId, @Param("startCity")String startCity,
      @Param("startAddress")String startAddress,@Param("endCity") String endCity,
      @Param("endAddress") String endAddress,@Param("appKey") String appKey);

  List<Line> findByAddress(@Param("companyId")Long companyId,
      @Param("startCity")String startCity, @Param("startAddress")String startAddress,
      @Param("endCity") String endCity,@Param("endAddress") String endAddress,
      @Param("appKey") String appKey);

  List<Line> querylineByCity(@Param("city") String city, @Param("appKey") String appKey);

  List<Line> lineIsExist(@Param("startCity") String startCity,
      @Param("startAddress") String startAddress,@Param("endCity") String endcity,
      @Param("endAddress") String endAddress, @Param("appKey") String appKey);

  List<Line> findLineByName(@Param("name") String name, @Param("appKey") String appKey,
      @Param("companyId") Long companyId);

  List<Line> findLineByParams(@Param("keyWord") String keyWord, 
      @Param("limit") Integer limit, @Param("rows") Integer rows, @Param("appKey") String appKey);
  
  List<Line> findEndByStart(@Param("startCity") String startCity, @Param("startAddress") String startAddress, 
	      @Param("limit") Integer limit, @Param("rows") Integer rows, @Param("appKey") String appKey);
  
  Long countLineByParams(
      @Param("keyWord") String keyWord, @Param("appKey") String appKey);
  
  Long countLineByStart(
	      @Param("startCity") String startCity, @Param("startAddress") String startAddress,  @Param("appKey") String appKey);
}
